<?php
$template['title']='我的留言';
include 'inc/userHead_inc.php';
include_once 'inc/page.inc.php';

if(isset($_GET['content'])){
	skip('comment.php', 'ok', '你真的要删除这条留言吗? <a href="Mymessage.php?confirm=1">确定</a> | <a href="Mymessage.php">取消<a>');
}

?>
	<div class="info">
		<div class="title">我的留言</div>
		<form action='' method='post'>
			<?php
			echo "<span class='message_ti'>留言内容：</span>";

				//查询是否有点评内容，如果没有就输入图标
				$query="select content from feedback where user='".$_COOKIE['youyou']['name']."'";
				$result=execute($link,$query);
				$data=mysqli_fetch_row($result);
				if(!$data){
					echo "<div class='noContent'><img src='img/noContent.png' /><br />您的留言空空如也</div>";
				}else{

				//分页部分
				echo "<div class='pages'>";

					$query="select content from feedback where user='".$_COOKIE['youyou']['name']."'";
					$result=execute($link,$query);
					$rows=mysqli_affected_rows($link);
					$query2="select * from userinfo where username='".$_COOKIE['youyou']['name']."'";
					$result2=execute($link,$query2);
					$data2=mysqli_fetch_assoc($result2);

					//调用分页函数
					$page=page($rows,5);

					$query="select * from feedback  where user='".$_COOKIE['youyou']['name']."' {$page['limit']}";
					$result=execute($link,$query);
					
					while ($data=mysqli_fetch_assoc($result)){

						$url=urlencode("message_delete.php?id={$data['id']}&url=Mymessage.php&content=1");
						$return_url=urlencode($_SERVER['REQUEST_URI']);
						$message="你真的要删除本条留吗？";
						$delete_url="confirm.php?url={$url}&return_url={$return_url}&message={$message}";
						echo "<div class='content2'><div class='headImg'><img src={$data2['headImg']} /></div> <div class='info2'>".$data['content']."</div><a href='$delete_url'>[删除]</a> <div class='time'>".$data['time']."</div> </div>";

					}

					echo "<div class='page_btn'>";
						//出入按钮HTML部分
						echo $page['html'];
					echo "</div>";

				echo "</div>";

			}
		?>
		</form>
	</div>
</div>
<?php
	include 'inc/footer_inc.php';
?>
